<template>
  <div>
    <h2>父组件</h2>
    <h4>银子: {{ money }}</h4>
    <h4>车: {{ car }}</h4>
    <Child/>
  </div>
</template>

<script setup lang="ts">
  import Child from './son.vue'
  import { ref, reactive, provide } from 'vue'

  let money = ref(100)

  let car = reactive({
    brand: '奔驰',
    price: 100
  })

  const addMoney = (val:number) => {
    money.value += val
  }


  // 这里不能 money.value 向后代提供数据(子，孙以后都能收到)
  provide('money', {money, addMoney})
  provide('qian', money)
  provide('che', car)

</script>

<style scoped>

</style>